﻿using System.Globalization;
using System.Windows.Data;

namespace Lib.WPF.Core;
/// <summary>
/// 布尔值转换器
/// </summary>
public class BooleanConvert : IValueConverter {
    /// <summary>
    /// 
    /// </summary>
    public object Convert(object Value, Type TargetType, object Parameter, CultureInfo Culture) {
        if (Value == null || !Value.ToString().Equals(Parameter.ToString())) {
            return false;
        }
        return true;
    }
    /// <summary>
    /// 
    /// </summary>
    public object ConvertBack(object Value, Type TargetType, object Parameter, CultureInfo culture) {
        return Value != null && Value.Equals(true) ? Parameter : Binding.DoNothing;
    }
}
